<template>
  <div>
    <FilterTable ref="table" :height="250" :columns="columns" :dataSource="dataSource" :onColumnsChange="columns => (this.columns = columns)"></FilterTable>
    <div class="btn-wrap">
      <el-button type="primary" @click="okBtnClick">确定</el-button>
      <el-button type="primary" @click="cancelBtnClick">取消</el-button>
    </div>
  </div>
</template>

<script>
import { getRepairImportPj } from '@/api/repair/business/customer/repairImport.js';
export default {
  name: '',
  props: {
    vin: {
      type: String,
      required: true
    }
  },
  data() {
    return {
      columns: [
        {
          title: '序号',
          sorter: true,
          dataIndex: 'index',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '仓库代码',
          sorter: true,
          dataIndex: 'STORAGE_CODE'
        },
        {
          title: '库位',
          sorter: true,
          dataIndex: 'STORAGE_POSITION_CODE'
        },
        {
          title: '备件代码',
          sorter: true,
          dataIndex: 'PART_NO'
        },
        {
          title: '备件名称',
          sorter: true,
          dataIndex: 'PART_NAME'
        },
        {
          title: '建议销售价',
          sorter: true,
          dataIndex: 'PART_SALES_PRICE'
        },
        {
          title: '销售价',
          sorter: true,
          dataIndex: 'SALES_PRICE'
        },
        {
          title: '数量',
          sorter: true,
          dataIndex: 'PART_QUANTITY'
        },
        {
          title: '金额',
          sorter: true,
          dataIndex: 'PART_SALES_AMOUNT'
        },
        {
          title: '备注',
          sorter: true,
          dataIndex: 'REMARK'
        }
      ],
      dataSource: []
    };
  },
  mounted() {
    this.getRepairImportPj();
  },
  methods: {
    // 查询维修备件 表格数据
    async getRepairImportPj() {
      const vin = this.vin;
      const params = {
        sort: 'PART_NO',
        order: 'asc',
        limit: 10,
        offset: 0,
        advice_labour: '[object Object]',
        advice_part: '',
        dmsFuncId: 35100010,
        _: new Date().getTime()
      };
      const res = await getRepairImportPj(vin, params);

      this.dataSource = res.rows;
    },
    okBtnClick() {},
    cancelBtnClick() {}
  }
};
</script>

<style lang="less" scoped>
.btn-wrap {
  display: flex;
  height: 60px;
  justify-content: center;
  align-items: center;
}
</style>
